package br.com.social.mobile.dao;

import javax.persistence.Query;

import org.apache.log4j.Logger;

import br.com.social.mobile.entities.Activation;


public class ActivationDAO extends GenericDAO<Activation>{
	
	private Logger logger = Logger.getLogger(ActivationDAO.class);
	
	public Activation getByKey(String key) {
		try {
			createEntityManager();
			Query query = entityManager
					.createQuery("select p FROM Activation p where p.dsKey= :dsKey");
			query.setParameter("dsKey", key);

			return (Activation) query.getSingleResult();
		} catch (Exception e) {
			logger.error(e);
			return null;
		}
		
	}		
	 
}
